package day6;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class CalTest3 {
    public static void main(String[] args) {
        //System.out.println(123=="123");
        Scanner in=new Scanner(System.in);
        System.out.println("请按照yyyy/MM/dd hh 格式输入日期：");
        String s = in.nextLine();//空格
        //String->Date
        SimpleDateFormat df=new SimpleDateFormat("yyyy/MM/dd H");
        df.setLenient(false);//宽松格式
        try {
            Date date = df.parse(s);
            System.out.println(date);
        } catch (ParseException e) {
            System.out.println("转换失败，输入错误");
            e.printStackTrace();
        }

    }
}
